package moodish.dummy.test;

import moodish.comm.ServerSideMessage;

public enum ServerSideMessageTypes {
	// Enum Definition
	CONNECT_CLIENT_1(getAddClient1()), CONNECT_CLIENT_2(getAddClient2()), CONNECT_CLIENT_3(
			getAddClient3()), DISCONNECT_CLIENT_1(getRemoveClient1()), DISCONNECT_CLIENT_2(
			getRemoveClient2()), DISCONNECT_CLIENT_3(getRemoveClient3()), FRIENDSHIP_1to2(
			getFriendship1to2()), FRIENDSHIP_1to3(getFriendship1to3()), FRIENDSHIP_3to1(
			getFriendship3to1()), UNFRIENDSHIP_1to2(getUnfriendship1to2()), UNFRIENDSHIP_1to3(
			getUnfriendship1to3()), UNFRIENDSHIP_3to1(getUnfriendship3to1()), MOODISH_1(
			getMoodMessage1()), MOODISH_3(getMoodMessage3()), MOODISH_1_BIG(
			getMoodMessage1_Big());

	// Define Enum Content
	private final ServerSideMessage message;

	// Constructor
	ServerSideMessageTypes(ServerSideMessage message) {
		this.message = message;
	}

	// Get Message
	ServerSideMessage getMessage() {
		return message;
	}

	// Message definition
	public static final String client1Name = "JUnitClient1";
	public static final String client2Name = "JUnitClient2";
	public static final String client3Name = "JUnitClient3";
	public static final String mood = "Happy";
	public static final String moodBig = "Happy Sad Angry Excited Thirsty Hungry";

	private static final ServerSideMessage getAddClient1() {
		return new ServerSideMessage() {

			@Override
			public Type getType() {
				return Type.CLIENT_CONNECTED;
			}

			@Override
			public String getPayload() {
				return null;
			}

			@Override
			public String getClientNickname() {
				return client1Name;
			}
		};
	}

	private static final ServerSideMessage getAddClient2() {
		return new ServerSideMessage() {

			@Override
			public Type getType() {
				return Type.CLIENT_CONNECTED;
			}

			@Override
			public String getPayload() {
				return null;
			}

			@Override
			public String getClientNickname() {
				return client2Name;
			}
		};
	}

	private static final ServerSideMessage getAddClient3() {
		return new ServerSideMessage() {

			@Override
			public Type getType() {
				return Type.CLIENT_CONNECTED;
			}

			@Override
			public String getPayload() {
				return null;
			}

			@Override
			public String getClientNickname() {
				return client3Name;
			}
		};
	}

	private static final ServerSideMessage getRemoveClient1() {
		return new ServerSideMessage() {

			@Override
			public Type getType() {
				return Type.CLIENT_DISCONNECTED;
			}

			@Override
			public String getPayload() {
				return null;
			}

			@Override
			public String getClientNickname() {
				return client1Name;
			}
		};
	}

	private static final ServerSideMessage getRemoveClient2() {
		return new ServerSideMessage() {

			@Override
			public Type getType() {
				return Type.CLIENT_DISCONNECTED;
			}

			@Override
			public String getPayload() {
				return null;
			}

			@Override
			public String getClientNickname() {
				return client2Name;
			}
		};
	}

	private static final ServerSideMessage getRemoveClient3() {
		return new ServerSideMessage() {

			@Override
			public Type getType() {
				return Type.CLIENT_DISCONNECTED;
			}

			@Override
			public String getPayload() {
				return null;
			}

			@Override
			public String getClientNickname() {
				return client3Name;
			}
		};
	}

	private static final ServerSideMessage getFriendship1to2() {
		return new ServerSideMessage() {

			@Override
			public Type getType() {
				return Type.FRIENDSHIP;
			}

			@Override
			public String getPayload() {
				return client2Name;
			}

			@Override
			public String getClientNickname() {
				return client1Name;
			}
		};
	}

	private static final ServerSideMessage getFriendship1to3() {
		return new ServerSideMessage() {

			@Override
			public Type getType() {
				return Type.FRIENDSHIP;
			}

			@Override
			public String getPayload() {
				return client3Name;
			}

			@Override
			public String getClientNickname() {
				return client1Name;
			}
		};
	}

	private static final ServerSideMessage getFriendship3to1() {
		return new ServerSideMessage() {

			@Override
			public Type getType() {
				return Type.FRIENDSHIP;
			}

			@Override
			public String getPayload() {
				return client1Name;
			}

			@Override
			public String getClientNickname() {
				return client3Name;
			}
		};
	}

	private static final ServerSideMessage getUnfriendship1to2() {
		return new ServerSideMessage() {

			@Override
			public Type getType() {
				return Type.UNFREINDSHIP;
			}

			@Override
			public String getPayload() {
				return client2Name;
			}

			@Override
			public String getClientNickname() {
				return client1Name;
			}
		};
	}

	private static final ServerSideMessage getUnfriendship1to3() {
		return new ServerSideMessage() {

			@Override
			public Type getType() {
				return Type.UNFREINDSHIP;
			}

			@Override
			public String getPayload() {
				return client3Name;
			}

			@Override
			public String getClientNickname() {
				return client1Name;
			}
		};
	}

	private static final ServerSideMessage getUnfriendship3to1() {
		return new ServerSideMessage() {

			@Override
			public Type getType() {
				return Type.UNFREINDSHIP;
			}

			@Override
			public String getPayload() {
				return client1Name;
			}

			@Override
			public String getClientNickname() {
				return client3Name;
			}
		};
	}

	private static final ServerSideMessage getMoodMessage1() {
		return new ServerSideMessage() {
			@Override
			public Type getType() {
				return Type.MOODISH_MESSAGE;
			}

			@Override
			public String getPayload() {
				return mood;
			}

			@Override
			public String getClientNickname() {
				return client1Name;
			}
		};
	}

	private static final ServerSideMessage getMoodMessage3() {
		return new ServerSideMessage() {
			@Override
			public Type getType() {
				return Type.MOODISH_MESSAGE;
			}

			@Override
			public String getPayload() {
				return mood;
			}

			@Override
			public String getClientNickname() {
				return client3Name;
			}
		};
	}

	private static final ServerSideMessage getMoodMessage1_Big() {
		return new ServerSideMessage() {
			@Override
			public Type getType() {
				return Type.MOODISH_MESSAGE;
			}

			@Override
			public String getPayload() {
				return moodBig;
			}

			@Override
			public String getClientNickname() {
				return client1Name;
			}
		};
	}
}
